package com.ygqh.baby.mapper;

import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.po.YgProduct;
import com.ygqh.baby.po.YgProductPackDetail;
import com.ygqh.baby.po.YgProductPackDetailExample;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * @author admin
 */
public interface YgProductPackDetailMapper {
    int countByExample(YgProductPackDetailExample example);

    int deleteByExample(YgProductPackDetailExample example);

    int deleteByPrimaryKey(Long id);

    int insert(YgProductPackDetail record);

    int insertSelective(YgProductPackDetail record);

    List<YgProductPackDetail> selectByExample(YgProductPackDetailExample example);

    YgProductPackDetail selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") YgProductPackDetail record, @Param("example") YgProductPackDetailExample example);

    int updateByExample(@Param("record") YgProductPackDetail record, @Param("example") YgProductPackDetailExample example);

    int updateByPrimaryKeySelective(YgProductPackDetail record);

    int updateByPrimaryKey(YgProductPackDetail record);

    int countSuper(@Param("q") String q);

    List<YgProductPackDetail> selectSuper(@Param("queryInfo") QueryInfo queryInfo, @Param("q") String q);

    /**
     * 获取参与其他自选包的商品id
     *
     * @param uncludedPackId 不包含的自选包id
     * @param productIds     参与判断的商品Ids
     * @param startDate      开始时间
     * @param endDate        结束时间
     * @return List<Long>
     */
    List<Long> getProductIdsInOtherPack(@Param("uncludedPackId") Long uncludedPackId, @Param("productIds") Long[] productIds,
                                        @Param("startDate") Date startDate, @Param("endDate") Date endDate);

    /**
     * 批量新增
     *
     * @param details 明细集合
     * @return int
     */
    int addBatch(@Param("details") List<YgProductPackDetail> details);

    /**
     * 获取参与自选包活动的商品id集
     *
     * @param packId 自选包id
     * @return List<Long>p
     */
    List<Long> selectProductIdsByPackId(@Param("packId") Long packId);

    /**
     * 批量删除
     *
     * @param packId        自选包id
     * @param productIdList 商品id集合
     * @param deleteBy      删除人
     * @return int
     */
    int deleteBatch(@Param("packId") Long packId, @Param("productIdList") List<Long> productIdList, @Param("deleteBy") String deleteBy);

    /**
     * 获取自选包商品信息
     *
     * @param packId 自选包id
     * @return List<YgProduct>
     */
    List<YgProduct> selectProductByPackId(@Param("packId") Long packId);
}



